# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org>
pkgname=libfm
pkgver=1.3.2
pkgrel=5
pkgdesc="Library for file management"
url="https://github.com/lxde/libfm"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	dbus-glib-dev
	gtk+3.0-dev
	gtk-doc
	intltool
	libexif-dev
	menu-cache-dev
	vala
	"
options="libtool"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="
	https://downloads.sourceforge.net/pcmanfm/libfm-$pkgver.tar.xz
	"
build() {
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--disable-static \
		--with-gtk=3 \
		--with-gnu-ld

	sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	rm -rf "$pkgdir"/usr/include/libfm
	mv "$pkgdir"/usr/include/libfm-1.0/ "$pkgdir"/usr/include/libfm

	# files provided by libfm-extra for bootstrap
	rm  "$pkgdir"/usr/lib/libfm-extra.* \
		"$pkgdir"/usr/lib/pkgconfig/libfm-extra.* \
		"$pkgdir"/usr/include/libfm/fm-xml-file.h \
		"$pkgdir"/usr/include/libfm/fm-extra.h \
		"$pkgdir"/usr/include/libfm/fm-version.h
}

sha512sums="
eaa3358cd1d8f611f8f4ac882e01a716b4dc32729b641417e1100aa039db3c57ae57ccc45df7dcac4f0570cd88684beba7752a5586c1d0598b1bc7502e99f4be  libfm-1.3.2.tar.xz
"
